package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;

/**
 * Controller class for the address book
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class AddressCtr
{
    
    //declare instance variables to reference containers
    //passed as arguments from the main class
    
    //Address container is to be passed as parameter from the main controller
    public AddressCtr()
    {
    }
    
    
    //Dummy implementation: after implementing the model layer 
    //objects of class Person are to be returned, not String
    /**
     * Get the person with the specifieD id
     */
    public void getPerson(long id)
    {
       AddressBook.getInstance().readPerson(id);
    }
    
    /**
     * Creates a new person using the given parameters
     */
    public boolean createPerson(long id, String name, String address, String postalCode, String city, String phone)
    {  
      return  AddressBook.getInstance().createNewPerson(id,name,address,postalCode,city,phone);
    }
    
    /**
     * Deletes the person with the specified id
     */
    public void deletePerson(long id)
    {
        AddressBook.getInstance().deletePerson(id);
    }
    
    /**
     * Updates the name of the specified person
     */
    
    public void updatePersonName(long id, String name)
    {
        AddressBook.getInstance().updatePersonName(id,name);
    }
    
    /**
     * Updates the address of the specified person
     */
    public void updatePersonAddress(long id, String address)
    {
        AddressBook.getInstance().updatePersonAddress(id,address);
    }
    
    /**
     * Updates the Postal Code of the specified person
     */
    public void updatePersonPostalCode(long id, String postalCode)
    {
        AddressBook.getInstance().updatePersonPostalCode(id,postalCode);
    }
    
    /**
     * Updates the City of the specified person
     */
    public void updatePersonCity(long id, String city)
    {
        AddressBook.getInstance().updatePersonCity(id,city);
    }
    
    /**
     * Updates the Phone Number of the specified person
     */
    public void updatePersonPhone(long id, String phone)
    {
        AddressBook.getInstance().updatePersonPhone(id,phone);
    }
        
       
        
    
    
    public void listAllPersons()
    {
        AddressBook.getInstance().listAllPersons();
    }
          
    
}
